package jsu.lipengcheng.trafficnet.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jsu.lipengcheng.trafficnet.pojo.Activity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface ActivityMapper extends BaseMapper<Activity> {

    List<Activity> selectbypage(LocalDate start, LocalDate end, Integer score, String name);

    @Select("select * from activity where status=#{status}")
    List<Activity> selectbystatus(Integer status);

    @Select("select count( id) from activity")
    int selectsum();

    @Update("update activity set num=num-1 where id=#{id} and num>0")
    int updatenum(Integer id);
}
